/*
 * Copyright 2010 Chad Retz
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package org.jdocng.shared.context;

import org.jdocng.shared.Configuration;
import org.jdocng.shared.model.ClassDocImpl;
import org.jdocng.shared.model.Logger;
import org.jdocng.shared.model.PackageDocImpl;
import org.jdocng.shared.model.RootDocImpl;

import com.google.common.annotations.GwtCompatible;
import com.sun.javadoc.Type;

/**
 * Context for storing/loading all javadoc information. This
 * can be implemented to use lazy loading if necessary
 *
 * @author Chad Retz
 */
@GwtCompatible
public interface Context {

    /**
     * Get the current configuration. This will be set
     * via {@link #setConfiguration(Configuration)}
     * 
     * @return
     */
    Configuration getConfiguration();
    
    /**
     * Set the configuration for this context
     * 
     * @param configuration
     */
    void setConfiguration(Configuration configuration);
    
    /**
     * Get the logger associated with this context. This
     * will be set via {@link #setLogger(Logger)}
     * 
     * @return
     */
    Logger getLogger();
    
    /**
     * Set the logger for this context
     * 
     * @param logger
     */
    void setLogger(Logger logger);
    
    /**
     * Get i18n messages
     * 
     * @return
     */
    Messages getMessages();
    
    /**
     * Set i18n messages
     * 
     * @param messages
     */
    void setMessages(Messages messages);
    
    /**
     * Get the root doc
     * 
     * @return
     */
    RootDocImpl getRootDoc();
    
    /**
     * Get all classes in this context. The result is
     * in no guaranteed order
     * 
     * @return
     */
    ClassDocImpl[] getAllClassDocs();

    /**
     * Get a class for the given qualified name
     * 
     * @param className
     * @return
     */
    ClassDocImpl getClassDoc(String className);

    /**
     * Get classes for the given qualified names. The 
     * result is in the order of the names (skipping
     * any that aren't found)
     * 
     * @param classNames
     * @return
     */
    ClassDocImpl[] getClassDocs(String... classNames);

    /**
     * Get all packages in this context. The result is
     * in no guaranteed order
     * 
     * @return
     */
    PackageDocImpl[] getAllPackageDocs();

    /**
     * Get a package for the given package name. The 
     * result is in the order of the names (skipping
     * any that aren't found)
     * 
     * @param packageName
     * @return
     */
    PackageDocImpl getPackageDoc(String packageName);

    /**
     * Get packages for the given package names
     * 
     * @param packageNames
     * @return
     */
    PackageDocImpl[] getPackageDocs(String... packageNames);

    /**
     * Get all types in this context. The result is
     * in no guaranteed order
     * 
     * @return
     */
    Type[] getAllTypes();

    /**
     * Get a type from the given name (not yet defined)
     * 
     * @param typeName
     * @return
     */
    Type getType(String typeName);
    
    /**
     * Get types from the given names (not yet defined). The 
     * result is in the order of the names (skipping
     * any that aren't found)
     * 
     * @param typeNames
     * @return
     */
    Type[] getTypes(String... typeNames);
}
